package com.itheima.exception;

import com.itheima.common.response.ResponseResult;
import com.itheima.common.response.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @作者 itcast
 * @创建日期 2020/10/10 14:14
 **/
@ControllerAdvice
public class ExceptionConfig {

    @ResponseBody
    @ExceptionHandler(Exception.class)
    public ResponseResult exceptionHandler(Exception e){
        return ResponseResult.errorResult(StatusCode.SERVER_ERROR);
    }
}
